#pragma once

#include <QColor>
#include <QVector3D>
#include <QOpenGLShaderProgram>

#include "dragon_global.h"

namespace Horse
{
	class DRAGON_EXPORT ILight
	{
	protected:
		QColor m_color;

	public:
		ILight(const QColor& color);

		inline void setColor(const QColor& color)
		{
			m_color = color;
		}

		virtual void useLight(QOpenGLShaderProgram* shaderProgram) = 0;

		virtual ~ILight() = default;
	};	

	class DRAGON_EXPORT AmbientLight : public ILight
	{
		friend class LightManager;
	private:
		float m_strength;

	private:
		AmbientLight(const QColor& color, float strength);

	public:	
		inline void setStrength(float strength)
		{
			m_strength = strength;
		}

		void useLight(QOpenGLShaderProgram* shaderProgram) override;

		~AmbientLight();
	};

	class DRAGON_EXPORT LightManager
	{
		friend class MaterialBuilder;
	private:
		AmbientLight* m_ambientLight;

	private:
		LightManager();

		QString& createLightShader(QString& code);

	public:
		static LightManager* getLightManager();

		void useLights(QOpenGLShaderProgram* shaderProgram);

	};
}
